package keeperproperties;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Properties;

import org.apache.log4j.Logger;


public class KeeperProperties {

	private static final String DELETE_ORDER = "deleteOrder";
	private static final String SHIFT_TIME_ORDER = "shiftTimeOrder";
	private static final String GARAGE_MANAGER = "garageManager";
	private static final String  garageProperty = "garageProperty" ;
	private static final String shiftProperty ="shiftProperty";
	private static final String deleteProperty = "deleteProperty" ;
	private static final String fileName = "test.properties";
	private static final String SORRY = "Sorry properties file not found";
	private Properties property = new Properties();
	private static KeeperProperties keeper_properties;
	private Logger log = Logger.getLogger(KeeperProperties.class);

	
	
	
	
	
	private HashMap<String, String> propertiesMap= new HashMap<String,String>();

	private KeeperProperties() {
		try {
			InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName);
			property.load(inputStream);
			
			
		} catch (IOException e) {
			log.error(SORRY);
			System.out.println(SORRY);
		}

	}

	public static KeeperProperties getInstance() {
		if (keeper_properties == null) {
			keeper_properties = new KeeperProperties();
		}
		return keeper_properties;
	}
	
 public HashMap<String,String> getProperties(){
	   propertiesMap.put(garageProperty,  property.getProperty(GARAGE_MANAGER));
	   propertiesMap.put(shiftProperty, property.getProperty(SHIFT_TIME_ORDER));
	   propertiesMap.put(deleteProperty,property.getProperty(DELETE_ORDER));
	  
	   
	   
	   return propertiesMap;		
	}

	
}
